# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ip2clue
pkgver=0.0.95
pkgrel=2
pkgdesc='A small memory/CPU footprint daemon to lookup country (and other info) based on IP (v4 and v6).'
groups=('blackarch' 'blackarch-recon')
url='http://kernel.embedromix.ro/us/'
license=('GPL3')
arch=('x86_64' 'aarch64')
depends=('bash' 'conn')
options=('!emptydirs')
source=("http://kernel.embedromix.ro/us/$pkgname/$pkgname-$pkgver.tar.gz"
        'ip2clued.service')
sha512sums=('700a978ae8f4f61cc1acf6711a32f65b6217c0b928ed2ef33058b4ac549133ab82f44bf22befc03f7806c57535b426d30211dd5a1663cb902ed6dd3da2dac702'
            '90e43e1a1482c2ab2234a63156a03bc728132abeccb7330d6326dbd93140b8a9bd109e92006c6fb9f9d4de553b4663452173953ae334ca06bd7864a75e4dc947')

build() {
  cd "$pkgname-$pkgver"

  ./configure --prefix=/usr

  make
}

package() {
  cd "$pkgname-$pkgver"

  make DESTDIR="$pkgdir" install

  mv "$pkgdir/usr/sbin/"* "$pkgdir/usr/bin"

  rm -rf "$pkgdir/etc/rc.d"

  install -Dm 644 "$srcdir/ip2clued.service" \
    "$pkgdir/usr/lib/systemd/system/ip2clued.service"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" Changelog README TODO
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

